import QuickTool from '@/utils/Engineering/QuickTool';

const operationList = [
  'handleOperaateJump',
  'handleModalEdit',
  'handleSingleCopy',
  'handleQuickEdit',
  'handleSingleQuickEdit',
  'handleModalSubmit',
  'handleSingleDelete',
];

const apiPath = {
  submitDataBaseURL: '/api/common/sys_form_set_field',
  getDatasourceURL: `/api/common/sys_form_set_field/page`,
  basis: 'id',
};

const extraData = { __sent_data_diff_cover_field: '' };

const pagination = { pageSize: 10, current: 1 };

const popupForm = {
  open_type: 'Drawer',
  width: '65%',
};

const fieldList = [
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '标签名称',
      help: '标签名称不可以为空',
      required: true,
    }),
    dataIndex_or_field: 'label',
    key: 'label',
    placeholder: '',
    width: 120,
    col: 12,
    fixed: 'left',
    initialValue: '',
    ellipsis: true,
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: 'UUID代码',
      help: '表单UUID代码是用来操作关联数据的唯一辨识符号',
      required: true,
    }),
    dataIndex_or_field: 'sys_form_set_code',
    key: 'sys_form_set_code',
    placeholder: '请输入UUID代码',
    width: 140,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '字段', help: '字段不可以为空', required: true }),
    dataIndex_or_field: 'field',
    key: 'field',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: '排序',
    dataIndex_or_field: 'sort',
    key: 'sort',
    placeholder: '请输入排序',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
    sorter: (a: any, b: any) => a.sort - b.sort,
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '必填', help: '输入框不可以为空' }),
    dataIndex_or_field: 'required',
    key: 'required',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: 'Col', help: 'Col' }),
    dataIndex_or_field: 'col',
    key: 'col',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: 8, name: 8 },
      { value: 12, name: 12 },
      { value: 24, name: 24 },
    ],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({
      title: '表单类型',
      help: '表单类型不可以为空',
      required: true,
    }),
    dataIndex_or_field: 'form_type',
    key: 'form_type',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },

  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '占位符提示', help: '输入框里面的提示信息' }),
    dataIndex_or_field: 'placeholder',
    key: 'placeholder',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },

  {
    form_type: 'Input',
    title_or_label: '标签提示信息',
    dataIndex_or_field: 'tooltip',
    key: 'tooltip',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: '分组显示',
    dataIndex_or_field: 'column_group',
    key: 'column_group',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '新增校验唯一性', help: '查看是否分页' }),
    dataIndex_or_field: 'is_check_unique',
    key: 'is_check_unique',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '验证提示信息', help: '校验时候的提示信息' }),
    dataIndex_or_field: 'message',
    key: 'message',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: '新增时显示',
    dataIndex_or_field: 'is_show_add',
    key: 'is_show_add',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: '修改时显示',
    dataIndex_or_field: 'is_show_update',
    key: 'is_show_update',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({
      title: '关联字段',
      help: '关联需绑定的字段，改变时候被关联的字段进行显示或者隐藏',
    }),
    dataIndex_or_field: 'show_relate_field',
    key: 'show_relate_field',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '校验唯一API地址', help: '校验唯一API地址' }),
    dataIndex_or_field: 'unique_url',
    key: 'unique_url',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '默认值', help: '默认值' }),
    dataIndex_or_field: 'initialValue',
    key: 'initialValue',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '函数关系', help: '' }),
    dataIndex_or_field: 'initialValue_cal',
    key: 'initialValue_cal',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: 'Api地址默认值', help: 'Api地址默认值' }),
    dataIndex_or_field: 'initialValue_url',
    key: 'initialValue_url',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '选择值来源', help: '选择值来源' }),
    dataIndex_or_field: 'value_source',
    key: 'value_source',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '选择词典代码', help: '选择词典代码' }),
    dataIndex_or_field: 'blade_dict_code',
    key: 'blade_dict_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '数据源API地址', help: '数据源API地址' }),
    dataIndex_or_field: 'datasource_url',
    key: 'datasource_url',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '查找表code', help: '查找表code' }),
    dataIndex_or_field: 'querytable_code',
    key: 'querytable_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '是否多选', help: '是否多选' }),
    dataIndex_or_field: 'multiple',
    key: 'multiple',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '是否多行文本', help: '是否多行文本' }),
    dataIndex_or_field: 'textarea',
    key: 'textarea',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '是否密码框', help: '是否密码框' }),
    dataIndex_or_field: 'password',
    key: 'password',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '显示时间', help: '显示时间' }),
    dataIndex_or_field: 'showTime',
    key: 'showTime',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '日期模式', help: '日期模式' }),
    dataIndex_or_field: 'datemode',
    key: 'datemode',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '前缀', help: '前缀' }),
    dataIndex_or_field: 'prefix',
    key: 'prefix',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '后缀', help: '后缀' }),
    dataIndex_or_field: 'suffix',
    key: 'suffix',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '最大值', help: '最大值' }),
    dataIndex_or_field: 'max',
    key: 'max',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '最小值', help: '最小值' }),
    dataIndex_or_field: 'min',
    key: 'min',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '步长', help: '步长' }),
    dataIndex_or_field: 'step',
    key: 'step',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '格式化数字', help: '格式化数字' }),
    dataIndex_or_field: 'formatter',
    key: 'formatter',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '自定义规则', help: '自定义规则' }),
    dataIndex_or_field: 'custom_rule',
    key: 'custom_rule',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '自定义风格', help: '自定义风格' }),
    dataIndex_or_field: 'custom_style',
    key: 'custom_style',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '禁止', help: '禁止' }),
    dataIndex_or_field: 'custom_style',
    key: 'custom_style',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '上传文件数量', help: '上传文件数量' }),
    dataIndex_or_field: 'file_count',
    key: 'file_count',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '上传文件大小', help: '上传文件大小' }),
    dataIndex_or_field: 'file_size',
    key: 'file_size',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'InputNumber',
    title_or_label: QuickTool.tooltip({ title: '是否隐藏', help: '是否隐藏' }),
    dataIndex_or_field: 'is_hide',
    key: 'is_hide',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '上传类型', help: '上传类型' }),
    dataIndex_or_field: 'upload_type',
    key: 'upload_type',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: 'file', name: '文件' },
      { value: 'image', name: '图片' },
    ],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '上传风格', help: '上传风格' }),
    dataIndex_or_field: 'listType',
    key: 'listType',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: 'picture', name: '照片' },
      { value: 'picture-card', name: '照片墙' },
      { value: 'text', name: '普通' },
    ],
  },
];

const tableOperateExpandList: never[] = [
  // maintableOperateExpandList.TableSettting,
  // maintableOperateExpandList.FormSetting,
  // maintableOperateExpandList.FormFieldSetting,
  // maintableOperateExpandList.QuerySetting,
];

const initialSearchList = [
  { ...fieldList[1], col: 6 },
  { ...fieldList[0], col: 6 },
  { ...fieldList[2], col: 6 },
  { form_type: '__operate', custom_sort: true },
  { ...fieldList[3], col: 6 },
];

const dataSource = [
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 1,
  },
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 2,
    field: 'content',
    form_type: 'Input',
  },
];

export {
  fieldList,
  initialSearchList,
  dataSource,
  apiPath,
  tableOperateExpandList,
  pagination,
  extraData,
  operationList,
  popupForm,
};
